package com.fangcang.log.tracelog;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * @ClassName: com.fangcang.tracelog.TraceLog
 * @Description: 日志追踪Bean
 * @author jilong.xiao
 * @date 2018年12月5日
 */
public class TraceLog implements Serializable {
	private static final long serialVersionUID = 1L;
	// ============ 常量字符串 ==========================
	public static final String TYPE_START = "start";
	public static final String TYPE_INFO = "info";
	public static final String TYPE_ERROR = "error";
	public static final String TYPE_END = "end";
	public static final String TRACE_ID = "xtraceId";
	
	// ============ 属性 ================================
	private String traceId;//日志追踪ID
	private String parentId = "";//上一级的追踪ID
	private String appName;//应用名称
	private String bizName;//业务名称，标识具体细化业务
	private String classMethod;//执行类方法
	private Long startTime = System.currentTimeMillis();//开始时间
	private Long endTime;//结束时间
	@JsonInclude(Include.NON_NULL)
	private Long costTime;//内部耗时(单位：ms)，即内部服务调用耗时
	@JsonInclude(Include.NON_NULL)
	private Long totalTime; //总耗时(单位：ms)
	@JsonInclude(Include.NON_NULL)
	private String inData; //入参数据
	@JsonInclude(Include.NON_NULL)
	private String outData; //返回数据
	private String logType;//日志类型：开始（start）、信息（info）、错误（error）、结束（end）
	@JsonInclude(Include.NON_NULL)
	private String failType;//失败类型：枚举类型
	@JsonInclude(Include.NON_NULL)
	private String remark;//备注
	@JsonIgnore
	private Exception e; //异常对象，方便记录异常信息到Remark字段中
	
	public String getTraceId() {
		return traceId;
	}
	public void setTraceId(String traceId) {
		this.traceId = traceId;
	}
	public String getParentId() {
		return parentId;
	}
	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public String getBizName() {
		return bizName;
	}
	public void setBizName(String bizName) {
		this.bizName = bizName;
	}
	public String getClassMethod() {
		return classMethod;
	}
	public void setClassMethod(String classMethod) {
		this.classMethod = classMethod;
	}
	public Long getStartTime() {
		return startTime;
	}
	public void setStartTime(Long startTime) {
		this.startTime = startTime;
	}
	public Long getEndTime() {
		return endTime;
	}
	public void setEndTime(Long endTime) {
		this.endTime = endTime;
	}
	public Long getCostTime() {
		return costTime;
	}
	public void setCostTime(Long costTime) {
		this.costTime = costTime;
	}
	public Long getTotalTime() {
		return totalTime;
	}
	public void setTotalTime(Long totalTime) {
		this.totalTime = totalTime;
	}
	public String getInData() {
		return inData;
	}
	public void setInData(String inData) {
		this.inData = inData;
	}
	public String getOutData() {
		return outData;
	}
	public void setOutData(String outData) {
		this.outData = outData;
	}
	public String getLogType() {
		return logType;
	}
	public void setLogType(String logType) {
		this.logType = logType;
	}
	public String getFailType() {
		return failType;
	}
	public void setFailType(String failType) {
		this.failType = failType;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Exception getE() {
		return e;
	}
	public void setE(Exception e) {
		this.e = e;
	}
	
}
